﻿using School;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace SchoolTest
{
    
    
    [TestClass()]
    public class StudentTest
    {

        [TestMethod()]
        public void StudentConstructorNormalCaseTest()
        {
            string name = "Pesho";
            int facultyNumber = 10024;
            Student target = new Student(name, facultyNumber);
            Assert.AreEqual(name, target.Name, "Different names");
            Assert.AreEqual(facultyNumber, target.FacultyNumber, "Different faculty numbers");
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void StudentConstructorInvalidNameTest()
        {
            string name = "";
            int facultyNumber = 10024;
            Student target = new Student(name, facultyNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void StudentConstructorInvalidFacultyNumberTest()
        {
            string name = "asdfsadf";
            int facultyNumber = 0;
            Student target = new Student(name, facultyNumber);
        }

        [TestMethod()]
        public void EqualsTrueTest()
        {
            string name = "Pesho";
            int facultyNumber = 10001;
            Student target = new Student(name, facultyNumber);
            object obj = new Student(name, facultyNumber);
            bool expected = true;
            bool actual;
            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void EqualsFalseTest()
        {
            string name = "Pesho";
            int facultyNumber = 10001;
            Student target = new Student(name, facultyNumber);
            object obj = new Object();
            bool expected = false;
            bool actual;
            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void EqualsNullTest()
        {
            string name = "Pesho";
            int facultyNumber = 10001;
            Student target = new Student(name, facultyNumber);
            object obj = null;
            bool expected = false;
            bool actual;
            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetHashCodeTest()
        {
            string name = "Pesho";
            int facultyNumber = 10024;
            Student target = new Student(name, facultyNumber);
            int expected = facultyNumber;
            int actual;
            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);
        }
    }
}
